package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.MarketComment;
import com.cskaoyan.bean.common.BasePageInfo;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.common.CommonData;
import com.cskaoyan.bean.vo.wx.comment.WxCommentCountVo;
import com.cskaoyan.bean.vo.wx.comment.WxCommentListVo;
import com.cskaoyan.bean.vo.wx.comment.WxCommentPostBO;
import com.cskaoyan.service.wx.WxCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

/**
 * /**
 *
 * @author xyh
 * @since 2022/11/23 17:13
 */
@RestController
@RequestMapping("wx/comment")
public class WxCommentController {
    @Autowired
    WxCommentService wxCommentService;
    @RequestMapping("list")
    public BaseRespVo<CommonData<WxCommentListVo>> getComment(Integer valueId,Integer type,Integer limit,Integer page,Integer showType){
       CommonData commonData= wxCommentService.getRelatedGoods(valueId,type,limit,page,showType);
       return BaseRespVo.ok(commonData);
    }
   @GetMapping("count")
    public BaseRespVo commentCount(Integer valueId,byte type){
        WxCommentCountVo wxCommentCountVo =wxCommentService.countCount(valueId,type);
        return BaseRespVo.ok(wxCommentCountVo);
   }
   @PostMapping("post")
    public BaseRespVo commentPost(@RequestBody MarketComment marketComment){
        wxCommentService.postComment(marketComment);
        return BaseRespVo.ok();
   }
}
